package com.example.demo.AliPay.Service.Impl;

import com.alipay.api.AlipayApiException;
import com.example.demo.AliPay.Bean.Order;
import com.example.demo.AliPay.Config.Alipay;
import com.example.demo.AliPay.Config.Alirefund;
import com.example.demo.AliPay.Service.AliPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Auther: csp1999
 * @Date: 2020/11/13/21:56
 * @Description: 支付service 实现类
 */
@Service
public class AliPayServiceImpl implements AliPayService {

    @Autowired
    private Alipay alipay;

    @Autowired
    private Alirefund alirefund;

    @Override
    public String aliPay(Order order) throws AlipayApiException {
        return alipay.pay(order);
    }

    @Override
    public Boolean refund(String out_trade_nos, String total_amount){
        alirefund.refund(out_trade_nos,total_amount);
        return true;
    }

}
